//=============================================================================
// TF Warhead guided fire
//=============================================================================
class TFWLGuidedFire extends RedeemerFire;

function Projectile SpawnProjectile(Vector Start, Rotator Dir)
{
    local TFWLGuidedWarhead Warhead;
	local PlayerController Possessor;
    local controller c;

    if(Instigator==none) return none;

    Warhead = Weapon.Spawn(class'Taskforces.TFWLGuidedWarhead', Instigator,, Start, Dir);
    if (Warhead == None)
		Warhead = Weapon.Spawn(class'Taskforces.TFWLGuidedWarhead', Instigator,, Instigator.Location, Dir);
    if (Warhead != None)
    {
		Warhead.OldPawn = Instigator;
		Warhead.PlaySound(FireSound);
		Possessor = PlayerController(Instigator.Controller);
		Possessor.bAltFire = 0;
		if ( Possessor != None )
		{
			if ( Instigator.InCurrentCombo() )
				Possessor.Adrenaline = 0;
			Possessor.UnPossess();
			Instigator.SetOwner(Possessor);
			Instigator.PlayerReplicationInfo = Possessor.PlayerReplicationInfo;
			Possessor.Possess(Warhead);
		}
		Warhead.Velocity = Warhead.AirSpeed * Vector(Warhead.Rotation);
		Warhead.Acceleration = Warhead.Velocity;
		WarHead.MyTeam = Possessor.PlayerReplicationInfo.Team;
        warhead.PlayOwnedSound(Sound'TFMedia.WLfire',SLOT_Interact,1.5,,300);

        if(tfwlgun(weapon).grade>1)
	    {
            warhead.armor=150;
            warhead.damage=2000;
        }

        if(tfwlgun(weapon).grade>2)
            warhead.damage=4000;


		for ( c = Level.ControllerList; c!=None; c=c.nextController )
        {
            if(playercontroller(c)!=none && c.PlayerReplicationInfo.team!=Possessor.PlayerReplicationInfo.Team)
                playercontroller(c).ReceiveLocalizedMessage(class'TaskForces.TFNukeWarnMsg');
        }
    }
    else
    {
	 	Spawn(class'Taskforces.TFFlash',,, instigator.Location);
        Spawn(class'Taskforces.TFNKExp',,, instigator.Location);
        Instigator.PlaySound(sound'TFMedia.TFNKExp',SLOT_None,TransientSoundVolume/1.5,false,TransientSoundRadius/2);
		Weapon.HurtRadius(100, 400, class'Taskforces.DamTypeNKShock', 100000, Instigator.Location);
	}

	bIsFiring = false;
    StopFiring();
    return None;
}

defaultproperties
{
     FireSound=None
}
